home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 July: Mac OS SDK / Dev.CD Jul 00 SDK2.toast / Development Kits / Cross Platform / QuickTime 4.1.2 Windows SDK / CIncludes / CoreFoundation / CFDate.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-04-12  |  3.4 KB  |  160 lines  |  [TEXT/R*ch]

  1. /*
  2.      File:        CFDate.h
  3.  
  4.      Contains:    CoreFoundation date
  5.  
  6.      Version:    Technology:    Mac OS X
  7.                  Release:    QuickTime 4.1
  8.  
  9.      Copyright:    (c) 1999 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __COREFOUNDATION_CFDATE__
  18. #define __COREFOUNDATION_CFDATE__
  19.  
  20. #ifndef __COREFOUNDATION_CFBASE__
  21.     #include <CoreFoundation\CFBase.h>
  22. #endif
  23.  
  24.  
  25.  
  26.  
  27.  
  28. #if PRAGMA_ONCE
  29. #pragma once
  30. #endif
  31.  
  32. #ifdef __cplusplus
  33. extern "C" {
  34. #endif
  35.  
  36. #if PRAGMA_IMPORT
  37. #pragma import on
  38. #endif
  39.  
  40. #if PRAGMA_STRUCT_ALIGN
  41.     #pragma options align=mac68k
  42. #elif PRAGMA_STRUCT_PACKPUSH
  43.     #pragma pack(push, 2)
  44. #elif PRAGMA_STRUCT_PACK
  45.     #pragma pack(2)
  46. #endif
  47.  
  48. typedef double                             CFTimeInterval;
  49. typedef CFTimeInterval                     CFAbsoluteTime;
  50. /* absolute time is the time interval since the reference date */
  51. /* the reference date (epoch) is 00:00:00 1 January 2001. */
  52.  
  53. EXTERN_API_C( CFAbsoluteTime )
  54. CFAbsoluteTimeGetCurrent        (void);
  55.  
  56. extern const CFAbsoluteTime kCFAbsoluteTimeIntervalSince1970;
  57. extern const CFAbsoluteTime kCFAbsoluteTimeIntervalSince1904;
  58. typedef const struct __CFDate * CFDateRef;
  59. EXTERN_API_C( CFTypeID )
  60. CFDateGetTypeID                    (void);
  61.  
  62.  
  63. EXTERN_API_C( CFDateRef )
  64. CFDateCreate                    (CFAllocatorRef         allocator,
  65.                                  CFAbsoluteTime         at);
  66.  
  67.  
  68. EXTERN_API_C( CFAbsoluteTime )
  69. CFDateGetAbsoluteTime            (CFDateRef                 date);
  70.  
  71. EXTERN_API_C( CFTimeInterval )
  72. CFDateGetTimeIntervalSinceDate    (CFDateRef                 date,
  73.                                  CFDateRef                 otherDate);
  74.  
  75. EXTERN_API_C( CFComparisonResult )
  76. CFDateCompare                    (CFDateRef                 date,
  77.                                  CFDateRef                 otherDate,
  78.                                  void *                    context);
  79.  
  80. #if !defined(__CFTIMEZONE_STRUCT__)
  81.     #define __CFTIMEZONE_STRUCT__ 1
  82.     typedef const struct __CFTimeZone * CFTimeZoneRef;
  83. #endif
  84.  
  85. struct CFGregorianDate {
  86.     SInt32                             year;
  87.     SInt8                             month;
  88.     SInt8                             day;
  89.     SInt8                             hour;
  90.     SInt8                             minute;
  91.     double                             second;
  92. };
  93. typedef struct CFGregorianDate            CFGregorianDate;
  94.  
  95. struct CFGregorianUnits {
  96.     SInt32                             years;
  97.     SInt32                             months;
  98.     SInt32                             days;
  99.     SInt32                             hours;
  100.     SInt32                             minutes;
  101.     double                             seconds;
  102. };
  103. typedef struct CFGregorianUnits            CFGregorianUnits;
  104. enum {
  105.     kCFGregorianUnitsYears        = (1 << 0),
  106.     kCFGregorianUnitsMonths        = (1 << 1),
  107.     kCFGregorianUnitsDays        = (1 << 2),
  108.     kCFGregorianUnitsHours        = (1 << 3),
  109.     kCFGregorianUnitsMinutes    = (1 << 4),
  110.     kCFGregorianUnitsSeconds    = (1 << 5),
  111.     kCFGregorianAllUnits        = 0x00FFFFFF
  112. };
  113.  
  114.  
  115. EXTERN_API_C( Boolean )
  116. CFGregorianDateIsValid            (CFGregorianDate         gdate,
  117.                                  CFOptionFlags             unitFlags);
  118.  
  119. EXTERN_API_C( CFAbsoluteTime )
  120. CFGregorianDateGetAbsoluteTime    (CFGregorianDate         gdate,
  121.                                  CFTimeZoneRef             tz);
  122.  
  123. EXTERN_API_C( CFGregorianDate )
  124. CFAbsoluteTimeGetGregorianDate    (CFAbsoluteTime         at,
  125.                                  CFTimeZoneRef             tz);
  126.  
  127. EXTERN_API_C( SInt32 )
  128. CFAbsoluteTimeGetDayOfWeek        (CFAbsoluteTime         at,
  129.                                  CFTimeZoneRef             tz);
  130.  
  131. EXTERN_API_C( SInt32 )
  132. CFAbsoluteTimeGetDayOfYear        (CFAbsoluteTime         at,
  133.                                  CFTimeZoneRef             tz);
  134.  
  135. EXTERN_API_C( SInt32 )
  136. CFAbsoluteTimeGetWeekOfYear        (CFAbsoluteTime         at,
  137.                                  CFTimeZoneRef             tz);
  138.  
  139.  
  140. #if PRAGMA_STRUCT_ALIGN
  141.     #pragma options align=reset
  142. #elif PRAGMA_STRUCT_PACKPUSH
  143.     #pragma pack(pop)
  144. #elif PRAGMA_STRUCT_PACK
  145.     #pragma pack()
  146. #endif
  147.  
  148. #ifdef PRAGMA_IMPORT_OFF
  149. #pragma import off
  150. #elif PRAGMA_IMPORT
  151. #pragma import reset
  152. #endif
  153.  
  154. #ifdef __cplusplus
  155. }
  156. #endif
  157.  
  158. #endif /* __COREFOUNDATION_CFDATE__ */
  159.  
  160.